#include <stdio.h>
#define MAX 10
void InputArray(int *p,int m,int n)
{
    int i,j;
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            printf("please input the No.%d line No.%d row number:",i+1,j+1);
            scanf("%d",p+i*n+j);
        }
    }
}
void OutputArray(int *p,int m,int n)
{
    int i,j;
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            printf("%d  ",*(p+i*n+j));
        }
        putchar('\n');
    }
}
int FindMax(int *p,int m,int n,int *pLine,int *pRow)
{
    int i;
    int max=*(p);
    for(i=0;i<m*n;i++)
    {
        if(max<*(p+i))
        {
            max=*(p+i);
            *pRow=i%n;
            *pLine=(i-*(pRow))/n;
        }
    }
    return max;
}
void main()
{
    int m,n;
    int str[MAX][MAX];
    int *p=str;
    int Line,Row;
    int max;
    printf("please input how many lines of the matrix:");
    scanf("%d",&m);
    printf("please input how many rows of the matrix:");
    scanf("%d",&n);
    if(m<=10&&m>=1&&n<=10&&n>=1)
    {
        InputArray(p,m,n);
        OutputArray(p,m,n);
        max=FindMax(p,m,n,&Line,&Row);
        printf("the max number of the matrix is %d,and the subscript are %d and %d",max,Line,Row);
    }
    else
    {
        printf("something wrong with your input.");
        return;
    }
}
